<template>
	<image class="imgcont" :src="pic" @error="imgLoadError" :mode="mode"></image>
</template>
<script>
    export default {
        name: "imgitem",
        props: {
            src:{
                type: String,
                default: '/static/img/none.png'
            },
			mode:{
                type: String,
                default: 'scaleToFill'
            }
        },
        data() {
            return {
                show: true
            }
        },
		computed:{
			pic(){
				let _src = this.src;
				if(!_src){
					_src = '/static/img/none.png';
					this.mode = 'center';
				}
				return _src;
			}
		},
        methods: {
            imgLoadError() {
                this.src = '';
            }
        }
    }
</script>
<style>
	.imgcont{
		display: block;
		background-color: #EBEBEB;
		width:100%;
		height:100%;
	}
</style>